package org.csmzxy2334;

public class 数组最大值及其位置 {

     public static void main(String[] args) {
         int[] num= {52,63,1,14,36,95,6,10,27,40};
         int max = num[0];
         int maxIndex = 1;
         for (int i = 1; i < num.length; i++) {
             if (num[i] > max){
                 max = num[i];
                 maxIndex = i + 1;
             }
         }
         System.out.println("最大值是"+max);
         System.out.println("最大值位于数组中第"+maxIndex+"个位置");
    }
}
